package com.example.config;

import com.example.interceptor.LoginInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author yinxin
 * @version 1.0
 * @Description:
 * @date 2022/6/713:27
 */
@Slf4j
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        System.out.println(Thread.currentThread().getName());
        registry.addInterceptor(new LoginInterceptor())
                //添加拦截路径
                .addPathPatterns("/api/product/*/**","/api/order/*/**")
                .excludePathPatterns("/api/product/v1/detail/**");
//        WebMvcConfigurer.super.addInterceptors(registry);
    }
}
